home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / CTBUtilities.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  6.5 KB  |  274 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CTBUtilities.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __CTBUTILITIES__
  18. #define __CTBUTILITIES__
  19.  
  20.  
  21. #ifndef __MEMORY__
  22. #include <Memory.h>
  23. #endif
  24. /*    #include <Types.h>                                            */
  25. /*        #include <ConditionalMacros.h>                            */
  26. /*    #include <MixedMode.h>                                        */
  27.  
  28. #ifndef __DIALOGS__
  29. #include <Dialogs.h>
  30. #endif
  31. /*    #include <Errors.h>                                            */
  32. /*    #include <Windows.h>                                        */
  33. /*        #include <Quickdraw.h>                                    */
  34. /*            #include <QuickdrawText.h>                            */
  35. /*        #include <Events.h>                                        */
  36. /*            #include <OSUtils.h>                                */
  37. /*        #include <Controls.h>                                    */
  38. /*            #include <Menus.h>                                    */
  39. /*    #include <TextEdit.h>                                        */
  40.  
  41. #ifndef __STANDARDFILE__
  42. #include <StandardFile.h>
  43. #endif
  44. /*    #include <Files.h>                                            */
  45.  
  46. #ifndef __APPLETALK__
  47. #include <AppleTalk.h>
  48. #endif
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. #if GENERATINGPOWERPC
  55. #pragma options align=mac68k
  56. #endif
  57.  
  58. #ifdef __CFM68K__
  59. #pragma lib_export on
  60. #endif
  61.  
  62.  
  63. enum {
  64. /*    version of Comm Toolbox Utilities    */
  65.     curCTBUVersion                = 2,
  66. /*    Error codes/types    */
  67.     ctbuGenericError            = -1,
  68.     ctbuNoErr                    = 0
  69. };
  70.  
  71. typedef OSErr CTBUErr;
  72.  
  73.  
  74. enum {
  75.     chooseDisaster                = -2,
  76.     chooseFailed,
  77.     chooseAborted,
  78.     chooseOKMinor,
  79.     chooseOKMajor,
  80.     chooseCancel
  81. };
  82.  
  83. typedef unsigned short ChooseReturnCode;
  84.  
  85.  
  86. enum {
  87.     nlOk,
  88.     nlCancel,
  89.     nlEject
  90. };
  91.  
  92. typedef unsigned short NuLookupReturnCode;
  93.  
  94.  
  95. enum {
  96.     nameInclude                    = 1,
  97.     nameDisable,
  98.     nameReject
  99. };
  100.  
  101. typedef unsigned short NameFilterReturnCode;
  102.  
  103.  
  104. enum {
  105.     zoneInclude                    = 1,
  106.     zoneDisable,
  107.     zoneReject
  108. };
  109.  
  110. typedef unsigned short ZoneFilterReturnCode;
  111.  
  112. typedef pascal short (*DialogHookProcPtr)(short item, DialogPtr theDialog);
  113.  
  114. #if GENERATINGCFM
  115. typedef UniversalProcPtr DialogHookUPP;
  116. #else
  117. typedef DialogHookProcPtr DialogHookUPP;
  118. #endif
  119.  
  120. enum {
  121.     uppDialogHookProcInfo = kPascalStackBased
  122.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  123.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  124.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DialogPtr)))
  125. };
  126.  
  127. #if GENERATINGCFM
  128. #define NewDialogHookProc(userRoutine)        \
  129.         (DialogHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture())
  130. #else
  131. #define NewDialogHookProc(userRoutine)        \
  132.         ((DialogHookUPP) (userRoutine))
  133. #endif
  134.  
  135. #if GENERATINGCFM
  136. #define CallDialogHookProc(userRoutine, item, theDialog)        \
  137.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppDialogHookProcInfo, (item), (theDialog))
  138. #else
  139. #define CallDialogHookProc(userRoutine, item, theDialog)        \
  140.         (*(userRoutine))((item), (theDialog))
  141. #endif
  142.  
  143.  
  144. enum {
  145. /*    Values for hookProc items        */
  146.     hookOK                        = 1,
  147.     hookCancel                    = 2,
  148.     hookOutline                    = 3,
  149.     hookTitle                    = 4,
  150.     hookItemList                = 5,
  151.     hookZoneTitle                = 6,
  152.     hookZoneList                = 7,
  153.     hookLine                    = 8,
  154.     hookVersion                    = 9,
  155.     hookReserved1                = 10,
  156.     hookReserved2                = 11,
  157.     hookReserved3                = 12,
  158.     hookReserved4                = 13,
  159. /*    "virtual" hookProc items    */
  160.     hookNull                    = 100,
  161.     hookItemRefresh                = 101,
  162.     hookZoneRefresh                = 102,
  163.     hookEject                    = 103,
  164.     hookPreflight                = 104,
  165.     hookPostflight                = 105,
  166.     hookKeyBase                    = 1000
  167. };
  168.  
  169. /*    NuLookup structures/constants    */
  170. struct NLTypeEntry {
  171.     Handle                            hIcon;
  172.     Str32                            typeStr;
  173. };
  174. typedef struct NLTypeEntry NLTypeEntry;
  175.  
  176. typedef NLTypeEntry NLType[4];
  177.  
  178. struct NBPReply {
  179.     EntityName                        theEntity;
  180.     AddrBlock                        theAddr;
  181. };
  182. typedef struct NBPReply NBPReply;
  183.  
  184. typedef pascal short (*NameFilterProcPtr)(EntityName *theEntity);
  185.  
  186. #if GENERATINGCFM
  187. typedef UniversalProcPtr NameFilterUPP;
  188. #else
  189. typedef NameFilterProcPtr NameFilterUPP;
  190. #endif
  191.  
  192. enum {
  193.     uppNameFilterProcInfo = kPascalStackBased
  194.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  195.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EntityName*)))
  196. };
  197.  
  198. #if GENERATINGCFM
  199. #define NewNameFilterProc(userRoutine)        \
  200.         (NameFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture())
  201. #else
  202. #define NewNameFilterProc(userRoutine)        \
  203.         ((NameFilterUPP) (userRoutine))
  204. #endif
  205.  
  206. #if GENERATINGCFM
  207. #define CallNameFilterProc(userRoutine, theEntity)        \
  208.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppNameFilterProcInfo, (theEntity))
  209. #else
  210. #define CallNameFilterProc(userRoutine, theEntity)        \
  211.         (*(userRoutine))((theEntity))
  212. #endif
  213.  
  214. typedef pascal short (*ZoneFilterProcPtr)(ConstStr32Param theZone);
  215.  
  216. #if GENERATINGCFM
  217. typedef UniversalProcPtr ZoneFilterUPP;
  218. #else
  219. typedef ZoneFilterProcPtr ZoneFilterUPP;
  220. #endif
  221.  
  222. enum {
  223.     uppZoneFilterProcInfo = kPascalStackBased
  224.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  225.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ConstStr32Param)))
  226. };
  227.  
  228. #if GENERATINGCFM
  229. #define NewZoneFilterProc(userRoutine)        \
  230.         (ZoneFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture())
  231. #else
  232. #define NewZoneFilterProc(userRoutine)        \
  233.         ((ZoneFilterUPP) (userRoutine))
  234. #endif
  235.  
  236. #if GENERATINGCFM
  237. #define CallZoneFilterProc(userRoutine, theZone)        \
  238.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppZoneFilterProcInfo, (theZone))
  239. #else
  240. #define CallZoneFilterProc(userRoutine, theZone)        \
  241.         (*(userRoutine))((theZone))
  242. #endif
  243.  
  244. typedef NameFilterProcPtr nameFilterProcPtr;
  245.  
  246. typedef ZoneFilterProcPtr zoneFilterProcPtr;
  247.  
  248. extern pascal CTBUErr InitCTBUtilities(void);
  249. extern pascal short CTBGetCTBVersion(void);
  250. extern pascal short StandardNBP(Point where, ConstStr255Param prompt, short numTypes, NLType typeList, NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter, DialogHookUPP hook, NBPReply *theReply);
  251. extern pascal short CustomNBP(Point where, ConstStr255Param prompt, short numTypes, NLType typeList, NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter, DialogHookUPP hook, long userData, short dialogID, ModalFilterUPP filter, NBPReply *theReply);
  252. #if OLDROUTINENAMES
  253. #define NuLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter, hook, theReply)  \
  254.     StandardNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter,  \
  255.     hook, theReply)
  256. #define NuPLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter, hook, userData, dialogID, filter, theReply)  \
  257.     CustomNBP(where, prompt, numTypes, typeList, nameFilter,  \
  258.     zoneFilter, hook, userData, dialogID, filter, theReply)
  259. #endif
  260.  
  261. #ifdef __CFM68K__
  262. #pragma lib_export off
  263. #endif
  264.  
  265. #if GENERATINGPOWERPC
  266. #pragma options align=reset
  267. #endif
  268.  
  269. #ifdef __cplusplus
  270. }
  271. #endif
  272.  
  273. #endif /* __CTBUTILITIES__ */
  274.